import http from '../util/request.js'

export default {
    captcha: () => {
        console.log('请求验证码');
        return http({
            url: '/api/login/captcha',
            method: 'get'
        })
    },
    login:(obj)=>{
        return http({
            url:'/api/login/dologin',
            method:'post',
            //headers: { 'Content-Type': 'application/json' },
            //表单参数
            params:obj
        });
    },
    loginUser:(obj)=> {
        return http({
            url: '/api/login/dologinuser',
            method: 'post',
            params: obj
        });
    },
    logininfo:()=> {
        return http({
            url: '/api/login/logininfo',
            method: 'get'
        });
    },
    userinfo:()=> {
        return http({
            url: '/api/login/userinfo',
            method: 'get'
        });
    },
    sendEmailCode:(email)=> {
        return http({
            url: '/api/login/sendemailcode',
            method: 'get',
            params: { email }
        });
    },
    sendUserEmailCode:(email)=> {
        return http({
            url: '/api/login/senduseremailcode',
            method: 'get',
            params: { email }
        });
    },
    loginByEmail:(email,code)=> {
        return http({
            url: '/api/login/dologinbyemail',
            method: 'post',
            params: { email, code }
        });
    },
    loginUserByEmail:(email,code)=> {
        return http({
            url: '/api/login/dologinuserbyemail',
            method: 'post',
            params: { email, code }
        });
    }
}
